package com.example.demo.model.service;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.demo.datamatch.entity.YzTestMatch;
import com.example.demo.datamatch.service.IYzTestMatchService;
import com.example.demo.impdatalog.entity.ImpdataLog;
import com.example.demo.impdatalog.service.IImpdataLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author Administrator
 */
@Component
@DS("gp")
public class GreenPlumComponent {

    @Autowired
    private IYzTestMatchService yzTestMatchService;

    @Autowired
    private IImpdataLogService iImpdataLogService;

    public List<YzTestMatch> getMatchList() {
        LambdaQueryWrapper<YzTestMatch> query = Wrappers.lambdaQuery(YzTestMatch.class);
        query.eq(YzTestMatch::getFirstrecommendfield, "豫AC5757");
        return yzTestMatchService.list(query);
    }

    public Page<ImpdataLog> getImpdataLogList() {
        Page<ImpdataLog> page = new Page<>(0, 20);
        page.setTotal(40);
        LambdaQueryWrapper<ImpdataLog> query = Wrappers.lambdaQuery(ImpdataLog.class);
        return iImpdataLogService.page(page, query);
    }
}
